package just.stuff.morsels.ui.user;

import just.stuff.morsels.MorselSession;
import just.stuff.morsels.objects.User;
import just.stuff.morsels.util.TextLink;

import org.apache.wicket.model.Model;

public final class UserPageLink extends TextLink<String> {
	public UserPageLink(String id ) {
		super(id,UserPage.class, new Model<String>() {
	    	@Override
	    	public String getObject() {
	    		User user = MorselSession.get().getUser();
	    		return user != null ? user.getEmail() : "";
	    	}
	    });
	}

	@Override
	public boolean isVisible() {
		return MorselSession.isSignedIn();
	}
}